{% load display_tags %}
{% load navigation_tags %}
<div data-multiple='true' class="panel panel-available-widget">
    <div class="panel-heading tight" title="Click and drag to move" data-toggle="tooltip">
        <div class="clearfix">
            <h5 class="pull-left">Findings</h5>
            <span class="fa-solid fa-arrows-up-down-left-right pull-right icon"></span>
        </div>
    </div>
    <div class="panel-body">
        <div class="panel panel-available-widget">
            <div class="panel-heading">
                <h6>Filters</h6>
            </div>
            <div class="panel-body">
                {% if extra_help %}
                    <div class="alert alert-info" role="alert">
                        {{ extra_help }}
                    </div>
                {% endif %}
                {% include "dojo/report_filter_snippet.html" with form=filtered.form title=title%}
            </div>
        </div>

        {% if findings %}
            <div class="clearfix finding-pagination">
                {% include "dojo/paging_snippet.html" with page=findings page_size=False %}
            </div>
            <div class="table-responsive">
                <table id="open_findings"
                       class="tablesorter-bootstrap table table-bordered table-condensed table-striped table-hover">
                    <thead>
                    <tr>
                        {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %}
                        <th class="nowrap">{% dojo_sort request 'Name' 'title' %}</th>
                        {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %}
                        <th class="nowrap">{% dojo_sort request 'Date' 'date' %}</th>
                        {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %}
                        <th class="nowrap">{% dojo_sort request 'Severity' 'numerical_severity' 'asc' %}</th>
                        <th class="nowrap">{% dojo_sort request 'EPSS Score' 'epss_score' %}</th>
                        <th class="nowrap">{% dojo_sort request 'EPSS Percentile' 'epss_percentile' %}</th>
                        <th class="nowrap">Status</th>
                        {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %}
                        <th class="nowrap">{% dojo_sort request asset_label 'test__engagement__product__name' %}</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for finding in findings %}
                        <tr>
                            <td>
                                <a title="{{ finding.title }}" href="{% url 'view_finding' finding.id %}">{{ finding.title }}</a>
                                {% include "dojo/snippets/tags.html" with tags=finding.tags.all %}
                            </td>
                            <td class="nowrap">{{ finding.date }}</td>
                            <td>{{ finding.severity }}</td>
                            <td>{{ finding.epss_score|format_epss }}</td>
                            <td>{{ finding.epss_percentile|format_epss }}</td>
                            <td>{{ finding.status }}</td>
                            <td>{{ finding.test.engagement.product }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
            <div class="clearfix finding-pagination">
                {% include "dojo/paging_snippet.html" with page=findings page_size=False %}
            </div>

        {% endif %}
    </div>
</div>
